Obtaining parameter values from the parameter block

Since Crystal Reports passes the values for a Formula Editor function's parameters in a parameter block rather than individually, you must separate the values from the parameter block before they can be evaluated. For the Picture function (see Picture Function - a sample UFL function), expect the parameter block to contain two parameters, both of type String, as defined in the function definition table.

To obtain the values of the individual parameters, begin by defining pointers to two structures of type UFParamListElement (defined in UFDLL.H):

UFParamListElement    *FirstParam,
    *SecondParam;

Next, call the GetParam function (defined in UFMAIN.C) for each UFParamListElement to obtain a pointer to each parameter from the parameter block:

FirstParam = GetParam (ParamBlock, 1);
SecondParam = GetParam (ParamBlock, 2);

The actual value is stored in the Parameter member of the UFParamListElement according to the type of data it contains. The Parameter member is a UFParamUnion type (a union data type holding a value according to the type of data expected). Since both of the parameters are of type String, you can obtain the actual parameter value for each UFParamListElement by using the following notation:

FirstParam->Parameter.ParamString
SecondParam->Parameter.ParamString

If, on the other hand, the second parameter contained a numeric value, you could use this notation:

SecondParam->Parameter.ParamNumber

Study the UFParamUnion union definition in the UFDLL.H file for a complete list of all possible parameter types and how to obtain a value from them.



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com